#ifndef __M_EVENTUNIT_H__
#define __M_EVENTUNIT_H__

#include <functional>
#include <string>

class EventUnit;
using handler_t = std::function<int(EventUnit* )>;
class Reactor;

struct EventUnit {
    int _sockfd;
    Reactor* _R;

    handler_t _recver;
    handler_t _sender;
    handler_t _error;

    // 设置输入输出缓冲区
    std::string _inbuffer;
    std::string _outbuffer;

    void RegisterCallback(handler_t recver, handler_t sender, handler_t errorer) {
        _recver = recver;
        _sender = sender;
        _error = errorer;
    }
};


#endif